package Helpers;

import javax.mail.*;
import javax.mail.internet.*;
//import javax.activation.*;

/**
 * 
 * @author Ritsjert
 */
public class MailStuur {
    /**
     *
     * @param smtpHost
     * @param smtpPort
     * @param from
     * @param to
     * @param subject
     * @param content
     * @throws javax.mail.internet.AddressException
     * @throws javax.mail.MessagingException
     */
    public static void send(String smtpHost, int smtpPort, String from, String to, String subject,
     String content) throws AddressException, MessagingException {

   java.util.Properties props = new java.util.Properties();
   props.put("mail.smtp.host", smtpHost);
   props.put("mail.smtp.port", "" + smtpPort);
   Session session = Session.getDefaultInstance(props, null);

   Message msg = new MimeMessage(session);
   msg.setFrom(new InternetAddress(from));
   msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
   //msg.setRecipient(Message.RecipientType.TO, new InternetAddress("rbeijnes@gmail.com"));
   msg.setSubject(subject);
   msg.setText(content);

   Transport.send(msg);
 }
}